home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tclX6.4c / dist / tests / setfuncs.test < prev    next >
Encoding:
Text File  |  1992-11-07  |  3.3 KB  |  142 lines

  1. #
  2. # setfuncs.test
  3. #
  4. # Tests for tcl.tlib set functions.
  5. #---------------------------------------------------------------------------
  6. # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: setfuncs.test,v 2.0 1992/10/16 04:50:14 markd Rel $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. if {[info procs test] == ""} then {source testlib.tcl}
  20.  
  21. rename SAVED_UNKNOWN unknown
  22.  
  23. test setfuncs-1.1 {union command} {
  24.     union "" ""
  25. } ""
  26.  
  27. test setfuncs-1.2 {union command} {
  28.     union a ""
  29. } "a"
  30.  
  31. test setfuncs-1.3 {union command} {
  32.     union "a b" "b c"
  33. } "a b c"
  34.  
  35. test setfuncs-1.4 {union command} {
  36.     union "a b c d" "a b c d"
  37. } "a b c d"
  38.  
  39. test setfuncs-1.5 {union command} {
  40.     union "a d c d b" "b d c a a b d a b c d"
  41. } "a b c d"
  42.  
  43. test setfuncs-1.6 {union command} {
  44.     union "d c b a e f" ""
  45. } "a b c d e f"
  46.  
  47. test setfuncs-1.7 {union command} {
  48.     union "" "f e d c b a"
  49. } "a b c d e f"
  50.  
  51. test setfuncs-1.8 {union command} {
  52.     union "{n p}" "f e d c b a"
  53. } "a b c d e f {n p}"
  54.  
  55. test setfuncs-1.9 {union command} {
  56.     union "{n p}" "f e d c {n p} b a"
  57. } "a b c d e f {n p}"
  58.  
  59. test setfuncs-1.10 {union command} {
  60.     union "{n p} z {n p} z" "f e d c {n p} b a"
  61. } "a b c d e f {n p} z"
  62.  
  63.  
  64. test setfuncs-2.1 {intersect command} {
  65.     intersect "" ""
  66. } ""
  67.  
  68. test setfuncs-2.2 {intersect command} {
  69.     intersect "a b c" ""
  70. } ""
  71.  
  72. test setfuncs-2.3 {intersect command} {
  73.     intersect "" "a b c"
  74. } ""
  75.  
  76. test setfuncs-2.4 {intersect command} {
  77.     intersect "d f b" "a b c"
  78. } "b"
  79.  
  80. test setfuncs-2.5 {intersect command} {
  81.     intersect "a p q d v m b n o z t d f b" "a b c"
  82. } "a b"
  83.  
  84. test setfuncs-2.6 {intersect command} {
  85.     intersect "d c b a e f" "{n p}"
  86. } ""
  87.  
  88. test setfuncs-2.7 {intersect command} {
  89.     intersect "d c" "f e d c b a"
  90. } "c d"
  91.  
  92. test setfuncs-2.8 {intersect command} {
  93.     intersect "a f {n p} e" "f e d c b a"
  94. } "a e f"
  95.  
  96. test setfuncs-2.9 {intersect command} {
  97.     intersect "{n p} f d" "f e d c {n p} b a"
  98. } "d f {n p}"
  99.  
  100. test setfuncs-2.10 {intersect command} {
  101.     intersect "{n p} z {n p} z" "f e d c {n p} b a"
  102. } "{n p}"
  103.  
  104. test setfuncs-3.1 {intersect3 command} {
  105.     intersect3 "" ""
  106. } "{} {} {}"
  107.  
  108. test setfuncs-3.2 {intersect3 command} {
  109.     intersect3 "a b c" ""
  110. } "{a b c} {} {}"
  111.  
  112. test setfuncs-3.3 {intersect3 command} {
  113.     intersect3 "" "a b c"
  114. } "{} {} {a b c}"
  115.  
  116. test setfuncs-3.4 {intersect3 command} {
  117.     intersect3 "d f b" "a b c"
  118. } "{d f} b {a c}"
  119.  
  120. test setfuncs-3.5 {intersect3 command} {
  121.     intersect3 "a p q d v m b n o z t d f b" "a b c"
  122. } "{d f m n o p q t v z} {a b} c"
  123.  
  124. test setfuncs-4.1 {lrmdups command} {
  125.     lrmdups {a d b c eee b d 1}
  126. } {1 a b c d eee}
  127.  
  128. test setfuncs-4.2 {lrmdups command} {
  129.     lrmdups {aaa aaa aaaa aaa aaa }
  130. } {aaa aaaa}
  131.  
  132. test setfuncs-4.3 {lrmdups command} {
  133.     lrmdups {{} aaa {} aaa aaa }
  134. } {{} aaa}
  135.  
  136. test setfuncs-4.4 {lrmdups command} {
  137.     lrmdups {aaa}
  138. } {aaa}
  139.  
  140. rename unknown SAVED_UNKNOWN
  141.  
  142.